package com.crr.controller;

import com.crr.bean.PageResult;
import com.crr.bean.User;
import com.crr.bean.UserQuery;
import com.crr.bean.ResultBean;
import com.crr.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@Api(tags = "用户管理")
@RequestMapping("/api/sys")
public class UserController extends BaseController{
    @Autowired
    UserService userService;

    @ApiOperation("保存用户")
    @PostMapping("/user")
    public ResultBean save(@RequestBody User user){
        int rs=userService.saveEntity(user);
        return saveResult(rs);
    }
    @GetMapping("/query")
    public ResultBean query( UserQuery userPage){
        PageResult<User> query = userService.query(userPage);
        return success("分页查询列表",query);
    }
}
